#define _GNU_SOURCE

#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>


void sigHandler(int sig){
    printf("Recived signal %d\n", sig);
}

int main(){
    struct sigaction actIgn, actHandl;
    actIgn.sa_handler = SIG_IGN;
    actHandl.sa_handler = &sigHandler;

    for(int sig = 1; sig < NSIG; sig++){
        if (sigaction(sig, &actHandl, NULL) == -1)
            printf("Error sig %d\n", sig);
    }

    if (sigaction(SIGPIPE, &actIgn, NULL) == -1){
        printf("Error sigaction SIGPIPE %s\n", strerror(errno));
        exit(EXIT_FAILURE);
    }

    printf("Current pid = %d, SIGPIPE 13 is SIG_IGN, set pause()\n", getpid());
    pause();

}